package com.example.demo.controller;

import com.example.demo.model.Dishes;
import com.example.demo.model.Ingredients;
import com.example.demo.service.RecommendationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class RecommendationController {
    private final RecommendationService recommendationService;

    @Autowired
    public RecommendationController(RecommendationService recommendationService) {
        this.recommendationService = recommendationService;
    }

    //    @GetMapping("/recommendations/{userId}")
//    public String getRecommendations(@PathVariable Long userId) {
//        // 根据用户 ID 获取推荐菜品列表
//        String recommendations = recommendationService.getRecommendations(userId.toString());
//        return recommendations;
//    }
    @GetMapping("/recommendations/ingredients/{userId}")
    public List<Ingredients> getRecommendedIngredients(@PathVariable Long userId) {
        // 根据用户 ID 获取推荐食材列表
        List<Ingredients> recommendedIngredients = recommendationService.getRecommendedIngredients(userId);
        return recommendedIngredients;
    }

    @GetMapping("/recommendations/food/{userId}")
    public List<Dishes> getRecommendedFood(@PathVariable Long userId) {
        // 根据用户 ID 获取推荐美食链表
        List<Dishes> recommendedFood = recommendationService.getRecommendedFood(userId);
        return recommendedFood;
    }
}
